﻿using Kanban.BLLContainer;
using Kanban.IBLL;
using Kanban.Model;
using KanbanApi.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web.Http;

namespace KanbanApi.Controllers
{
    public class InterfaceDefaultController : BaseController
    {
        private readonly IInterfaceDefaultService InterfaceDefaultService = Container.Resolve<IInterfaceDefaultService>();

        [HttpGet]
        [Route("api/InterfaceDefault/GetData")]
        public async Task<Table<object>> GetData(string search, int pageSize, int pageIndex)
        {
            var response = await InterfaceDefaultService.GetSysConfigPageData(search, pageSize, pageIndex);
            return new Table<object>(response.Item1, response.Item2);
        }


        [HttpGet]
        [Route("api/InterfaceDefault/GetModel")]
        public Task<InterfaceDefault> GetModel(int id)
        {
            return InterfaceDefaultService.GetModelAsync(id);
        }

        [HttpPost]
        [Route("api/InterfaceDefault/Save")]
        public Task<bool> Save(InterfaceDefaultRequest request)
        {
            return InterfaceDefaultService.Save(request.Model);
        }
    }
}